function seckill_timecounter() {
            var _starttime, _endtime;

            function init() {

                $.ajax({
                    type: "get",
                    async: false,
                    url: "http://recom-s.vancl.com/CmsSeckill/GetMainIndexSeckillForWww",
                    cache: false,
                    dataType: "jsonp",
                    data: { showNum: 5 },
                    jsonp: "callback",
                    success: function (data) {
                         if (data == undefined || data == null || data.data == undefined || data.data == null){
                            return;
                        }

                        $('.new_miaosha_area').css('display', 'block');
                        $('#seckill_2017_container').css('display', 'block');
                        //$('#seckill_2017_container').html(data);

                        _starttime = seckill_getdatetime(data.data.startTime);
                        _endtime = seckill_getdatetime(data.data.endTime);

                        seckill_2017_timecounter();

                        var UrlSecKill = "http://recom-s.vancl.com/product/GetProductInfosBySeckill";
                        var _data = "productcodes=" + data.data.productCodes;
                        $.ajax({
                            type: "get",
                            async: false,
                            data: _data,
                            url: UrlSecKill,
                            cache: false,
                            dataType: "jsonp",
                            jsonp: "callback",
                            success: function (products) {
                                var elems = $('#seckill_2017_container ul li');

                                for (var i = 0; i < 5; i++) {
                                    var elem = $(elems[i]);//只有5个；


                                    var product = products[i];
                                    var _p1 = product.ProductCode.substring(0, 1);
                                    var _p2 = product.ProductCode.substring(1, 2);
                                    var _p3 = product.ProductCode.substring(2, 3);
                                    var _photo = "http://p3.vanclimg.com/232/232/product/" + _p1 + "/" + _p2 + "/" + _p3 + "/" + product.ProductCode + "/mid/" + product.Photos[0].FileName;
                                    var _url = product.ItemUrl;

                                    elem.find('a').attr('href', _url);
                                    elem.find('img').attr('src', _photo);

                                    elem.find('.new-miaosha-productname span').html(product.ProductName);
                                    elem.find('.new-miaosha-oldprice em').html(product.Price);
                                    elem.find('.new-miaosha-saleprice em').html(product.SPrice);

                                    var deposit = parseInt(product.SPrice) / 2;

                                    elem.find('.new-miaosha-afterdeposit em').html(deposit);
                                }
                            },
                            error: function (e) {
                            }
                        });

                    },
                    error: function (e) {

                    }
                });
            }

            function seckill_getdatetime(datestr) {
                var arr = datestr.split(' ');
                var date = arr[0];
                var time = arr[1];
                var dateArr = date.split('-');
                var y = dateArr[0];
                var mm = dateArr[1];
                var d = dateArr[2];

                var timeArr = time.split(':');
                var h = timeArr[0];
                var m = timeArr[1];
                var s = timeArr[2];

                return new Date(y, mm - 1, d, h, m, s);
            }
	

            function seckill_2017_timecounter() {
                var _seckill_starttime = _starttime;//seckill_getdatetime("2017-9-27 15:00:00");  //秒杀开始时间
                var _seckill_endtime = _endtime;// seckill_getdatetime("2017-9-27 16:00:00");   //秒杀结束时间


                //获取当前时间
                var date = new Date();
                var now = date.getTime();
                //设置截止时间
                var starttime = _seckill_starttime.getTime();
                var endtime = _seckill_endtime.getTime();
                var _times;
                var counttime;
                if (now < starttime) {
                    //秒杀还没有开始
                    _times = "秒杀即将开始，距开始还有";
                    counttime = starttime;
                }
                else if (now>= starttime && now < endtime) {
                    //秒杀中
                    counttime = endtime;
                    _times = "秒杀进行中，距结束还有"
                }
                else {
                    //秒杀结束
                    _times = "该场秒杀已结束";
                }
                //时间差
                if (counttime) {
                    var leftTime = counttime - now;
                    //定义变量 d,h,m,s保存倒计时的时间
                    var d, h, m, s;
                    if (leftTime>= 0) {
                        d = Math.floor(leftTime / 1000 / 60 / 60 / 24);
                        h = Math.floor(leftTime / 1000 / 60 / 60 % 24);
                        m = Math.floor(leftTime / 1000 / 60 % 60);
                        s = Math.floor(leftTime / 1000 % 60);
                        if (h < 10) {
                            h = "0" + h;
                        }

                        if (m < 10) {
                            m = "0" + m;
                        }

                        if (s < 10) {
                            s = "0" + s;
                        }
                        _times = "<em class='wordBox'>" + _times + "</em>" + h + "<em></em>" + m + "<em></em>" + s;
                    } else {
                        _times = "<em class='wordBox'>" + _times + "</em>" + "00" + "<em></em>" + "00" + "<em></em>" + "00";
                    }
                    $("#seckill_2017_timecounting").html(_times);
                    setTimeout(seckill_2017_timecounter, 1000);
                } else {
                    $("#seckill_2017_timecounting").html("<em class='wordBox'>" + _times + "</em>" + "00" + "<em></em>" + "00" + "<em></em>" + "00");
                }
            }

            return function () {
                init();
            }
        }
		  
    $(function (){
        //-------焦点图
        if ($("#slider").responsiveSlides) {
            //根据querystring的值，调整焦点图中的图片顺序
            var firstKey = $("#slider").attr("data-firstKey");
            if (firstKey) {
                var item = $("li[data-focusflag='" + firstKey + "']", $("#slider"));
                if (item.size() == 1 && item.index()> 0) {
                    $("#slider").prepend(item.clone());
                    item.remove();
                }
            }
            $("#slider").responsiveSlides({ auto: true, pager: true, speed: 500, pause: true, nav: true });
        }

        new seckill_timecounter()();

    });


$(document).ready(function () {
        //遮罩层
        var tipOverlay = $("#overlay");
        if (tipOverlay.length> 0) {
            $("span.screenAdClose", tipOverlay).click(function () { closeTipOverlay(); });
            window.setTimeout(function () { closeTipOverlay(); }, 10000);
        }

        var setting = { closeTipOverlay: false };
        var closeTipOverlay = function () {
            tipOverlay.fadeOut();
            //-------vjia浮窗
            if (setting.closeTipOverlay == false && VANCL.www.VjiaFloatad != undefined) {
                setting.closeTipOverlay = true;
                VANCL.www.VjiaFloatad.init();
            }
        }
    });



$(document).ready(function(){
            var h = window.navigator.userAgent;
            if(h.match(/AppleWebKit\/([\d.]*)/) && /Mobile\//.test(h) && h.match(/iPad|iPod|iPhone/)){
                $("#ipad_pop").fadeIn();    
            }
            $("#ipad_close").click(function(){
                $("#ipad_pop").fadeOut();
            });
            
        });


window.onload = function(){
$(".publicfooterclear ul li").eq(1).find("p").eq(1).html("7天内退货");
}



$(document).ready(function () { var hostname = window.location.host; 
        if (hostname != "demowww.vancl.com" && hostname != "www.vancl.com" && hostname != "www.fanke.com") { $(".subnavCon em").css({ display: "block" }); 
        $(".subnavCon").hover(function () { $(this).find("em").addClass("emtop"); 
            $(this).parent().find(".categoryList").show(); 
        }, function () { $(this).find("em").removeClass("emtop"); 
        $(this).parent().find(".categoryList").hide(); }); 
        $(".categoryList").hover(function () { $(this).show(); 
        }, function () { $(this).hide(); $(this).parent().find(".subnavCon em").removeClass("emtop"); 
    }); 
    } }); 
     setTimeout(function () { var bp = document.createElement('script'); bp.src = '//push.zhanzhang.baidu.com/push.js'; var s = document.getElementsByTagName("script")[0]; 
        s.parentNode.insertBefore(bp, s); 
    }, 1000); 
     $(function () { $(".subNav").hide(); 
        $(".navlist ul li").hover(function () { $(this).find(".subNav").stop(true, true); 
            $(this).find(".subNav").slideDown(); 
        }, function () { $(this).find(".subNav").stop(true, true); 
        $(this).find(".subNav").slideUp(); 
    }); })














